<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="../assets/js/layui/css/layui.css" media="all">
</head>
<body>
<div></div>
<div class="layui-form"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
  <!-- <div class="layui-form-item">
    <label class="layui-form-label">修改订单状态</label>
    <div class="layui-input-block">
      <input type="text" name="" placeholder="请输入修改订单状态的Id" autocomplete="off" class="layui-input">
    </div> 
  </div>-->
  <div class="layui-form-item">
    <label class="layui-form-label">修改状态</label>
    <div class="layui-input-block">
      <select name="interest" lay-filter="aihao">
        <option value="1">未付款</option>
        <option value="2">已付款</option>
        <option value="3">已取消</option>
        <option value="4">已删除</option>
      </select>
    </div>
  </div>
<!--   <div class="layui-form-item">
    <label class="layui-form-label">复选框</label>
    <div class="layui-input-block">
      <input type="checkbox" name="like[write]" title="写作">
      <input type="checkbox" name="like[read]" title="阅读">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">开关关</label>
    <div class="layui-input-block">
      <input type="checkbox" lay-skin="switch">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">开关开</label>
    <div class="layui-input-block">
      <input type="checkbox" checked lay-skin="switch">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">单选框</label>
    <div class="layui-input-block">
      <input type="radio" name="sex" value="0" title="男">
      <input type="radio" name="sex" value="1" title="女" checked>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">请填写描述</label>
    <div class="layui-input-block">
      <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
    </div>
  </div> -->
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
  <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
</div>
<script  src="../assets/js/jquery-3.3.1.js"></script>
<script src="../assets/js/layui/layui.js"></script> 
<script  src="../assets/js/layer/layer.js"></script>
<script src="../static/js/test.js" ></script>

<script  type="text/javascript">
 var orderId = getUrlParam('orderId');  //引用 test.js 方法
 
 function updateOrder(activeId){
	  
	  $.ajax({   //修改订单状态
			url:"/moviesMaven/order/updateOrder.htm",
			dataType:"json",
			data:{"orderId":orderId,"activeId":activeId},
			success:function (data) {
			
				if(data.success){
					alert("更改状态成功！");
					/* if(activeId==1||activeId==2){  //如果改为状态为未付款与已付款 座位需改成正常状态
						
					}else{
						
					} */
					
					
				}else{
					
					alert(data.message);
					
				}
			},
			error:function(XMLHttpRequest, textStatus, errorThrown){
				
			  alert(textStatus+":"+XMLHttpRequest.status);
				
			} 
		}); 
 }

layui.use('form', function(){
  var form = layui.form;
  
  //监听提交
  form.on('submit(formDemo)', function(data){
	 var str =  JSON.stringify(data.field);
	 var dataObj=eval("("+(str)+")");
	  var activeId = dataObj.interest
	  if(confirm("确定修改该订单状态吗?") ){
		 
		  updateOrder(activeId);
		  
	  }
	
	  
    /* layer.msg(JSON.stringify(data.field)+orderId);
    return false; */
  });
  
});
</script>

</body>
</html>